<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="./js/vue.min.js"></script>

<body>
    <div id="app">
        <div :style="{fontSize:blogFontSize+'rem'}">
            <blog v-for="item in arr" :blog="item" @abc="blogFontSize+=0.02"></blog>
        </div>

    </div>

    <script>
        //组件
        Vue.component('blog', {
            props: ['blog'],

            template: `
            <div>
            <h3>{{blog.title}}</h3>
            <span>
                <button @click="$emit('abc')">点我有惊喜</button>
            </span>
            </div>
            `
        })
        //实例
        let app = new Vue({
            el: '#app',
            data:{
                blogFontSize:1,
                arr: [
                        { id: 1, title: '三体' },
                        { id: 1, title: '你是人间四月天' },
                        { id: 1, title: '活着'},
                    ]
            },
            methods:{
                enlarge:function(){
                    console.log('上当了！');
                    this.blogFontSize+=1;
                }
            }
        })
    </script>
</body>

</html>